package cn.edu.scau.cmi.wujiaming.experiment3.abstractFactory.factory;

import cn.edu.scau.cmi.wujiaming.experiment3.abstractFactory.insuracne.Insurance;

public abstract class CompanyFactory {
	
	public abstract Insurance getAutomobileDamage();
	public abstract Insurance getDriverInjured();
	public abstract Insurance getMultipleAccidents();
	public abstract Insurance getPersonalCasualty();
	
	public static CompanyFactory getCompanyFactory(String name) {
		if (name == null) return null;
		
		if (name.equals("人寿保险")) {
			return new PICCFactory();
		} else if (name.equals("平安保险")) {
			return new PingAnFactory();
		} else {
			return null;
		}
	}
}
